package com.goods.business.converter;

import com.goods.business.service.SupplierService;
import com.goods.common.model.business.InStock;
import com.goods.common.model.business.Supplier;
import com.goods.common.vo.business.InStockVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class InStockConverter {
    public static List<InStockVO> converterToInStockVOList(List<InStock> stocks) {
        if (!CollectionUtils.isEmpty(stocks)){
            List<InStockVO> inStockVOS = new ArrayList<>();
            for (InStock stock : stocks) {
                InStockVO inStockVO = new InStockVO();
                BeanUtils.copyProperties(stock,inStockVO);
                inStockVO.setSupplierId(stock.getSupplierId());
                inStockVOS.add(inStockVO);
            }
            return inStockVOS;
        }
        return null;
    }
}
